﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"CodeFile="ZbsxOperation.aspx.cs"
    Inherits="Wsbs_ZbsxOperation" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderContent" runat="Server">
    <script type="text/javascript" src="../ScriptFile/jquery.js"></script>
    <script type="text/javascript" src="../ScriptFile/AutoIframeHeight.js"></script>
    <script type="text/javascript">
        var isSaveSuccess = false;
        var currentUrl, currentCtrlId;

        //保存后的逻辑处理
        function SaveIId() {
            isSaveSuccess = true;
            alert("保存成功");
        }

        //消息提示框
        function ConfirmMsg(strInfo) {
            return confirm(strInfo);
        }

        function SaveInfo() {
            //老保存方法
            frmChild.SaveAll(SaveIId);
            //新保存方法
            //frmChild.SaveAll(true, SaveIId);
        }


        function SubmitInfo(strIID, strFlag) {
            if (!ConfirmMsg("确定您填写的申请信息符合要求并提交吗？")) {
                return;
            }

            if ($("#saveform").css("display") != "none") {
                frmChild.SaveAll(); //提交时,自动保存 addby zhongjian 20091218
            }


            $.ajax({
                url: 'AjaxTsqkSubmit.ashx',
                data: "dataIId=" + strIID + "&flag=" + strFlag,
                type: 'GET',
                dataType: 'text',
                cache: false,
                async: false,
                timeout: 1000,
                error: function () {
                    alert('提交失败');
                },
                success: function (data) {
                    alert('提交成功');
                    $("#saveform").attr("disabled", true);
                    $("#submitform").attr("disabled", true);
                }
            });
        }

        //设置tabcontrol按钮的背景颜色,并判断是否进行过表单修改
        function SetBackColor(varCtrl, strUrl, strTabName) {
            //判断表单是否更改
            var ischange = false;

            //因材料上传不包含判断是否修改的方法，所以此处要添加异常处理
            try {
                ischange = frmChild.IsFormChanged();
            }
            catch (e) {
            }

            if (ischange) //数据已修改
            {
                currentUrl = strUrl;
                currentCtrlId = varCtrl.id;

                var varEnableSave = $("#saveform").attr("disabled");
                //判断按钮是否可用
                if (varEnableSave == false) {
                    isSaveSuccess = false;

                    //按三种选项模式框提示 edit by zhongjian 20091109
                    if (ConfirmMsg("表单数据已修改，是否保存？")) {
                        isSaveSuccess = false;
                        SaveInfo();
                    }
                    else {
                        isSaveSuccess = true;
                    }
                }
            }
            else {
                isSaveSuccess = true;
            }

            //判定是否保存成功
            if (isSaveSuccess) {
                $("#frmChild").attr("src", strUrl);
                $("#tabMenu td[id ^= 'td']").attr("class", "tabcontrol_button03");
                $("#" + varCtrl.id).attr("class", "tabcontrol_button05");

                //排除上传附件
                if (strTabName == "-1") {
                    $("#saveform").hide();
                }
                else {
                    $("#saveform").show();
                }
                //end
            }
        }

        //页面加载时执行
        $(document).ready(function () {
            $("#tabMenu td:first").click();
        });

        function framePrint() {
            if ($("#frmChild").attr("src") != "") {
                window.open($("#frmChild").attr("src").replace("Default.aspx", "HtmlPage/HtmlMainPage.aspx") + "&act=Print", "printfrm", "width=1,height=1");
            }
        }
    </script>
    <div>
        <table border="0" width="100%" id="tabMenu" style="width: 799px; height: 30px; background-image: url(../App_Themes/SkinFile/Images/shenbao.gif);">
            <tr>
                <%=GetContent()%>
                <td align="right">
                    <%=GetSubmit()%>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <iframe name="frmChild" id="frmChild" width="720px" onload="SetWinHeight(this);"
                        frameborder="0" scrolling="no"></iframe>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
